﻿using GameFramework.Event;
using GameFramework;
using TowerDefence_Zombie.Data;

namespace TowerDefence_Zombie
{
    public class ChangeTowerGridEventArgs : GameEventArgs
    {
        public static readonly int EventId = typeof(ChangeTowerGridEventArgs).GetHashCode();

        public int GridId
        {
            get;
            private set;
        }

        public int TowerId
        {
            get;
            private set;
        }

        public int TowerLevel
        {
            get;
            private set;
        }

        public bool IsUpgrade
        {
            get;
            private set;
        }

        public ChangeTowerGridEventArgs()
        {
            GridId = 0;
            TowerId = 0;
            TowerLevel = 0;
        }

        public override int Id
        {
            get
            {
                return EventId;
            }
        }

        public object UserData
        {
            get;
            private set;
        }

        public bool isUpgrade
        {
            get
            {
                return IsUpgrade;
            }
        }

        public static ChangeTowerGridEventArgs Create(int towerGridId, int towerId, int towerLevel,bool isUpgrade, object userData = null)
        {
            ChangeTowerGridEventArgs showPreviewTowerEventArgs = ReferencePool.Acquire<ChangeTowerGridEventArgs>();
            showPreviewTowerEventArgs.GridId = towerGridId;
            showPreviewTowerEventArgs.TowerId = towerId;
            showPreviewTowerEventArgs.TowerLevel = towerLevel;
            showPreviewTowerEventArgs.IsUpgrade = isUpgrade;

            return showPreviewTowerEventArgs;
        }

        public override void Clear()
        {
            TowerId = 0;
            GridId = 0;
            TowerLevel = 0;
            IsUpgrade = false;
        }
    }

}

